//
//  kWCommonHeadView.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 2017/5/25.
//  Copyright © 2017年 EasyToTesco. All rights reserved.
//

#import "kWCommonHeadView.h"

@interface  kWCommonHeadView()
@property(nonatomic,strong)UILabel *titleLabel;

@end

@implementation kWCommonHeadView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.titleLabel];
    }
    return self;
}

- (void)setText:(NSString *)text
{
    _text = [text copy];
    self.titleLabel.text = text;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    WeakSelf(self);
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(weakself);
    }];
}

- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = FONT(14);
        _titleLabel.textColor = UIColorFromRGB(0xfa3802);
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}

@end
